package com.bytedance.common.plugin.component;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.bytedance.common.plugin.a;
import com.bytedance.common.plugin.framework.PluginManager;

public class BaseProxyReceiver extends BroadcastReceiver {
    private BroadcastReceiver mPluginReceiver;

    public BaseProxyReceiver() {

    }

    protected String getPluginClass() {
        return a.a.get(this.getClass().getName());
    }

    public void onReceive(Context arg2, Intent arg3) {
        this.tryLoadPlugin();
        if(this.mPluginReceiver != null) {
            this.mPluginReceiver.onReceive(arg2, arg3);
        }
    }

    private void tryLoadPlugin() {
        if(this.mPluginReceiver != null) {
            PluginManager.getPluginManager();
            this.mPluginReceiver = ComponentHelper.loadPluginReceiver(PluginManager.getHostClassLoader(), this.getPluginClass());
        }
    }
}

